<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>资金管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">
            <div class="layui-col-md1">
                <button class="layui-btn layui-btn-sm layui-btn-normal" onclick="history.go(-1)">返回上一页</button>
            </div>
        </div>
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <input type="hidden" id="bid" name="bid" value="${bid}">
            <input type="hidden" id="timeDays" name="timeDays" value="${timeDays}">
        </div>

        <div class="layui-card-body">
            <table class="layui-table" lay-filter="table" id="table">
                <script type="text/html" id="toolbar">
                    <div class="layui-btn-container">
                        <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail">查看订单</a>
                    </div>
                </script>
        </div>
    </div>
</div>


<script src="/layuiadmin/layui/layui.js" charset="utf-8"></script>
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate', 'table'], function () {
        var $ = layui.$, form = layui.form,
            element = layui.element, laydate = layui.laydate, table = layui.table;

        form.render('select');
        laydate.render({
            elem: '#laydate-cn',
            range: '~'
        });
        table.render({
            elem: '#table',
            url: '/account/queryBusinessOrderRefundDetail?timeDays=' + $('#timeDays').val() + '&bid=' + $('#bid').val(),
            page: true,
            request: {
                pageName: 'current', //页码的参数名称，默认：page
                limitName: 'size'//每页数据量的参数名，默认：limit
            },
            cols : [[
                {field : 'orderCode', title:'订单编号', minWidth:160},
                {field : 'bNickName', title:'所属店铺', minWidth:160},
                {field : 'createTime', title : '创建时间', minWidth:150,
                    templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm')}}</div>"
                },
                {field : 'payMoney', title : '支付金额', width:100},
                {field : 'point', title : '积分', width:70},
                {field : 'phone', title : '用户账户', width:120},
                {field : 'payTypeName', title : '支付方式', width:100},
                {field : 'orderFromChannel', title : '订单来源', width:100},
                {field : 'orderStatusName', title:'订单状态', width:130},
                {title : '操作', templet:'#toolbar'}
            ]],
            skin : "row",
            even: true,
            size:"lg"
        });

        var active = {
            detail:function(id){
                window.location.href = "/order/orderDetail?orderId="+id;
            }
        };


        //监听事件
        table.on('tool(table)', function(obj){
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的DOM对象
            if (layEvent === 'detail') {// 订单详情
                active[layEvent] && active[layEvent].call(this, data.id);
            }
        });

        //监听搜索
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;
            //执行重载
            table.reload('table', {
                where: field
            });
        });
    });


</script>
</body>
</html>